package top.kpromise.user.service_imp;

import org.springframework.stereotype.Service;
import top.kpromise.user.mapper.UserLoginMapper;
import top.kpromise.user.model.response.UserLoginModel;
import top.kpromise.user.service.UserLoginService;

@Service
public class UserLoginServiceImp implements UserLoginService {

    private final UserLoginMapper userLoginMapper;

    public UserLoginServiceImp(UserLoginMapper userLoginMapper) {
        this.userLoginMapper = userLoginMapper;
    }

    @Override
    public UserLoginModel findUser(String userId, int loginType) {
        return userLoginMapper.findUser(userId, loginType);
    }

    @Override
    public int insert(String userId, int loginType, String loginValue) {
        return userLoginMapper.insert(userId, loginType, loginValue);
    }

    @Override
    public String deleteByLoginTypeAndValue(String userId, int loginType) {
        return userLoginMapper.deleteByLoginTypeAndValue(userId, loginType);
    }

    @Override
    public int updateByUserId(String userId, String loginValue, int loginType) {
        return userLoginMapper.updateByUserId(userId, loginValue, loginType);
    }

    @Override
    public int disableLoginType(String userId, int loginType) {
        return userLoginMapper.disableLoginType(userId, loginType);
    }

    @Override
    public int enableLoginType(String userId, int loginType) {
        return userLoginMapper.enableLoginType(userId, loginType);
    }
}
